home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_09 / allison / uncheck.c < prev   
Encoding:
C/C++ Source or Header  |  1994-07-10  |  379 b   |  30 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. class string
  5. {
  6. public:
  7.     string(char *s)
  8.       {strcpy(data = new char[strlen(s)+1], s);}
  9.     operator char*()
  10.       {return data;}
  11. private:
  12.     int dummy;
  13.     char *data;
  14. };
  15.  
  16.  
  17. main()
  18. {
  19.     string s = "hello";
  20.     printf("%s\n",(char *) s);
  21.     printf("%s\n",s);
  22.     return 0;
  23. }
  24.  
  25. /* Output:
  26. hello
  27. (null)
  28. */
  29.  
  30.